/**
 * Created by LuckyYe on 2016/8/26.
 */
angular.module('service.conversation', [
        "ngResource",
        "ngStorage"
    ])
    .service('ConversationService', ['$resource', '$http', function ($resource, $http) {
        var converUrl = mall_expert + "conversation/";
        //通过topicid删除问答
        this.conver_removeByTid = function (tid) {
            var removeConverByTid = $resource(converUrl + "deleteByTopicId/:topid");
            removeConverByTid.remove({topid: tid});
        };
        //发送留言
        this.add_message = function (conversation, success_func, error_func) {
            var conver = $resource(converUrl);
            return conver.save(conversation, success_func, error_func);
        };
        //通过tid 得到所有问答
        this.getConversationById = function (tId) {
            var converList = $resource(converUrl + "bytopicid/:topicId");
            return converList.query({topicId: tId});
        };
        //得到所有问答
        this.getConversation = function () {
            var all_converList = $resource(converUrl);
            return all_converList.query();
        };

    }]);